package dto

import (
	"wxpay/internal/model"
	"wxpay/pkg/util"
)

type SubMchWithDrawDTO struct {
	ID            int64
	BrandID       string
	MchID         string
	SubMchID      string
	OutRequestNo  string
	WxWithdrawID  string
	BizWithdrawID string
	Amount        int64
	Remark        string
	BankMemo      string
	Status        string
	Reason        string
}

func AdaptSubMchWithdraw(info *SubMchWithDrawDTO) (r *model.SubMchWithdraw) {
	r = model.NewSubMchWithdraw(info.BrandID, info.MchID, info.SubMchID, info.BizWithdrawID, info.Amount, info.Remark, info.BankMemo)
	return
}

// model to dto
func ConvertSubMchWithdraw(info *model.SubMchWithdraw) (r *SubMchWithDrawDTO) {
	r = &SubMchWithDrawDTO{
		ID:            info.ID,
		BrandID:       info.BrandID,
		MchID:         info.MchID,
		SubMchID:      info.SubMchID,
		OutRequestNo:  info.OutRequestNo,
		WxWithdrawID:  util.ConvertNullString(info.WxWithdrawID),
		BizWithdrawID: info.BizWithdrawID,
		Amount:        info.Amount,
		Remark:        util.ConvertNullString(info.Remark),
		BankMemo:      util.ConvertNullString(info.BankMemo),
		Status:        info.Status,
		Reason:        util.ConvertNullString(info.Reason),
	}
	return
}
